<?php
declare (strict_types = 1);

namespace app\admin\validate;

use think\Validate;

class User extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名'	=>	['规则1','规则2'...]
     *
     * @var array
     */	
	protected $rule = [
        //"code" => "require",
        "parent_code" => "require",
        "nickname" => "require",
        "mobile" => "require|mobile|unique:user",
    ];
    
    /**
     * 定义错误信息
     * 格式：'字段名.规则名'	=>	'错误信息'
     *
     * @var array
     */	
    protected $message = [
        //'code.require' => '请填写会员编号',
//        'code.unique' => '会员编号已被注册',
        'parent_code.require' => '请填写推荐人编号',
        'nickname.require' => '请填写昵称',
//        'nickname.unique' => '用户名已被注册',
        'mobile.require' => '请填写手机号',
        'mobile.mobile' => '手机号格式错误',
        'mobile.unique' => '手机号已被注册',
    ];
}
